"""
It needs empty GameState
It can change phase from WelcomeScreen to
1) Settings phase
2) StartGame phase
3) Rules Phase
"""

import model.gamestate

from ui.hat_widget import HatWidget


class WelcomeScreen(HatWidget):
    def __init__(self, gamestate, presenter, **kwargs):
        """ Construct Welcome screen
            Args:
            gamestate: (GameState)
            mainview: (Presenter) main view presenter
        """
        super(WelcomeScreen, self).__init__(**kwargs)
        self.presenter = presenter
        self.gamestate = None

    def start_game(self):
        """ changes phase to Game Settings
            call on release 'Create Game' button
        """
        self.presenter.change_phase(model.gamestate.Phase.GAME_CONFIG)

    def fast_create(self):
        self.presenter.change_phase(model.gamestate.Phase.QUICK_GAME_SETTINGS)

    def open_rules(self):
        """changes phase to RULES phase
        call on release 'Rules' button
        """
        self.presenter.change_phase(model.gamestate.Phase.RULES)

    def load_game(self):
        """changes phase to LOAD_GAME phase
        call on release 'load game' button
        """
        self.presenter.change_phase(model.gamestate.Phase.LOAD_GAME)

    def go_back(self):
        self.presenter.request_app_close()
